/*
 * Copyright (C) 2011 Project R'yleh Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.Arkham;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.TextView;

public class Classroom extends Activity  implements OnClickListener{
	
	TextView speaking, text;
	int state;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		//removes title bar and sets the theme
        this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
        
		super.onCreate(savedInstanceState);
		setContentView(R.layout.conversations);
		
		View nextButton = findViewById(com.Arkham.R.id.next_button);
		nextButton.setOnClickListener(this);
        
		speaking = (TextView) findViewById(R.id.speaker_name);
		text = (TextView) findViewById(R.id.speaking_text);
        
		if ( GameFile.storyFlag[0] == true ){
			state = 0;
	        speaking.setText( "CLASS ROOM" );
	        text.setText( Dialogue.emptyclassroom()  );
		}
		else {
		   state = 1;
	       speaking.setText( "Teacher: ");
	       text.setText( "YOU'RE LATE!!!!" );
		}
		
	}
	public void onClick(View v) {
    	switch (state)
    	{
    	case 0:
    		finish();
    		break;
    	case 1:
    		speaking.setText( "Matt: ");
    		text.setText( Dialogue.classroom01() );
    		state++;
	    	break;
    	case 2:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom02() );
    		state++;
	    	break;
    	case 3:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom03() );
    		state++;
	    	break;
    	case 4:
    		speaking.setText( "George: ");
    		text.setText( Dialogue.classroom04() );
    		state++;
	    	break;
    	case 5:
    		speaking.setText( "Matt: ");
    		text.setText( Dialogue.classroom05() );
    		state++;
	    	break;
    	case 6:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom06() );
    		state++;
	    	break;
    	case 7:
    		speaking.setText( "George: ");
    		text.setText( Dialogue.classroom07() );
    		state++;
	    	break;
    	case 8:
    		speaking.setText( "Matt: ");
    		text.setText( Dialogue.classroom08() );
    		state++;
	    	break;
    	case 9:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom09() );
    		state++;
	    	break;
    	case 10:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom10() );
    		state++;
	    	break;
    	case 11:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom11() );
    		state++;
	    	break;
    	case 12:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom12() );
    		state++;
	    	break;
    	case 13:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom13() );
    		state++;
	    	break;
    	case 14:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom14() );
    		state++;
	    	break;
    	case 15:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom15() );
    		state++;
	    	break;
    	case 16:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom16() );
    		state++;
	    	break;
    	case 17:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom17() );
    		state++;
	    	break;
    	case 18:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom18() );
    		state++;
	    	break;
    	case 19:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom19() );
    		state++;
	    	break;
    	case 20:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom20() );
    		state++;
	    	break;
    	case 21:
    		speaking.setText( "Mr. Mullins: ");
    		text.setText( Dialogue.classroom21() );
    		state++;
	    	break;
    	case 22:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom22() );
    		//gained +25 money from George for lunch
    		GameFile.party.inventory.gainMoney(25);
    		state++;
	    	break;
    	case 23:
    		speaking.setText( "Matt: ");
    		text.setText( Dialogue.classroom23() );
    		state++;
	    	break;
    	case 24:
    		speaking.setText( "George: " );
    		text.setText( Dialogue.classroom24() );
    		state = 0;
    		GameFile.storyFlag[0] = true;
    		finish();
	    	break;
	    default:
	    	finish();
    	}
	}
}